
const ci = require('miniprogram-ci');

;(async () => {
  const project = new ci.Project({
    appid: 'wx-1234567890',
    type: 'miniProgram',
    projectPath: 'dist/build/mp-weixin',
    privateKeyPath: 'ci-script/private.key',
    ignores: ['node_modules/**/*'],
  });

  const uploadResult = await ci.upload({
    project,
    version: '1.1.1',
    desc: '测试版本',
    setting: {
      minifyWXML: true,         // 压缩 WXML 结构
      minifyJS: true,           // 压缩 JS 代码
      minifyWXSS: true,         // 压缩 WXSS 代码
      minify: true,             // 压缩上传的代码
      es6: false,               // 兼容 ES6 到 ES5
      es7: false,               // 兼容 ES7 到 ES5
      codeProtect: false,       // 上传后获取未压缩源码进行代码保护
      autoPrefixWXSS: false,    // 自动补全 CSS 单位
    },
    onProgressUpdate: console.log,
  })

  console.log(uploadResult)

})();
